import request from '@/utils/request';
import { rsaEncrypt } from '@/utils/commonUtil3';

// 新建用户
export function createUserInfo(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/user/insert',
		method: 'post',
		data: {
			data: data1
		}
	});
}

// 分页查询用户
export function queryUserInfo(data) {
	return request({
		url: '/user/select',
		method: 'get',
		params: data
	});
}

// 获取负责人列表
export function getPrincipalList() {
	return request({
		url: '/user/getHighers',
		method: 'get'
	});
}

// 编辑用户
export function editUserInfo(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/user/update',
		method: 'put',
		data: {
			data: data1
		}
	});
}

// 删除用户
export function deleteUserInfo(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/user/delete',
		method: 'delete',
		data: {
			data: data1
		}
	});
}

// 重置密码
export function resetPassword(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/user/resetPWD',
		method: 'post',
		data: {
			data: data1
		}
	});
}

// 修改密码
export function changePassword(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/user/updatePWD',
		method: 'put',
		data: {
			data: data1
		}
	});
}
